package cn.com.wxd.amumu.search.service;

import org.springframework.stereotype.Service;

import cn.com.wxd.amumu.search.IndexConfig;
import cn.com.wxd.amumu.search.ReturnContentType;
import cn.com.wxd.amumu.search.core.IndexSearch;

/**
 * Title:
 * Description:
 * <p>
 * Company: Amumu系统
 * Copyright: Copyright (c) 2017
 * All right reserved.
 * Created by WangXuDong on 2017/8/18.
 *
 * @author WangXuDong
 * @version 1.0
 */
@Service
public class SearchService {
    private IndexSearch indexSearch = new IndexSearch();

    public String[] search(String keyWord, ReturnContentType returnContent,
                           int recordCount, int pageIndex) throws Exception {
        if(keyWord == null || keyWord.isEmpty()){
            return null;
        }
        return indexSearch.search(keyWord, IndexConfig.INDEXPATH, returnContent, recordCount, pageIndex);
    }

    public String[] search(String keyWord, ReturnContentType returnContent, int maxCount) throws Exception {
        if(keyWord == null || keyWord.isEmpty()){
            return null;
        }
        return indexSearch.search(keyWord, IndexConfig.INDEXPATH, returnContent, maxCount, 1);
    }
}
